package com.shawn.baseappbygroovydsl.base

import android.app.Application
import com.shawn.baseappbygroovydsl.component.SoundPoolManager
import com.shawn.baseappbygroovydsl.ui.base.FragmentBase
import java.util.LinkedList

/**
 * 描述：
 * 作者： shawn
 * 时间： 2024/8/211:24
 */
class AppBase : Application()  {
    private var appFragList = LinkedList<FragmentBase<*>>()
    companion object {
        lateinit var instance: AppBase
    }

    override fun onCreate() {
        super.onCreate()
        instance = this
        SoundPoolManager.init(this)
    }

    fun dispatcherOnKeyCodeBack(): Boolean {
        for (i in appFragList.indices.reversed()) {
            if (appFragList[i].onKeyCodeBack()) {
                return true
            }
        }
        return false
    }
}